﻿using System;
using System.Windows.Forms;
using GDFlacTool.Common;

namespace GDFlacTool.Forms
{
    public partial class FormHandleId3V1Tags : Form
    {
        private Id3Actions _id3Actions;

        public FormHandleId3V1Tags(Id3Actions id3Actions)
        {
            InitializeComponent();

            _id3Actions = id3Actions;
        }

        public Id3Actions Id3Actions
        {
            get { return _id3Actions; }
        }

        private void FormHandleId3V1Tags_Load(object sender, EventArgs e)
        {
            switch (Id3Actions)
            {
                case Id3Actions.WriteId3V1AndId3V2:
                    rbtSaveBoth.Checked = true;
                    break;
                case Id3Actions.WriteOnlyId3V2:
                    rbtSaveID3v2.Checked = true;
                    break;
                case Id3Actions.WriteOnlyId3V1:
                    rbtSaveID3v1.Checked = true;
                    break;
                case Id3Actions.WriteId3V2AndDeleteId3V1:
                    rbtSaveID3v2DeleteID3v1.Checked = true;
                    break;
                default:
                    rbtSaveBoth.Checked = true;
                    break;
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            //Properties.MainSettings.Default.Id3Actions = (int) Id3Actions;
        }

        private void rbtSaveBoth_CheckedChanged(object sender, EventArgs e)
        {
            if (rbtSaveBoth.Checked)
            {
                _id3Actions = Id3Actions.WriteId3V1AndId3V2;
            }
        }

        private void rbtSaveID3v2_CheckedChanged(object sender, EventArgs e)
        {
            if (rbtSaveID3v2.Checked)
            {
                _id3Actions = Id3Actions.WriteOnlyId3V2;
            }
        }

        private void rbtSaveID3v1_CheckedChanged(object sender, EventArgs e)
        {
            if (rbtSaveID3v1.Checked)
            {
                _id3Actions = Id3Actions.WriteOnlyId3V1;
            }
        }

        private void rbtSaveID3v2DeleteID3v1_CheckedChanged(object sender, EventArgs e)
        {
            if (rbtSaveID3v2DeleteID3v1.Checked)
            {
                _id3Actions = Id3Actions.WriteId3V2AndDeleteId3V1;
            }
        }
    }
}
